#include "SOC_GX.h"
#include "rtwtypes.h"
#include "Timer_Delay_Check_CRC_SOC.h"
#include "SOC_GX_private.h"

void Timer_Delay_Check_CRC_SOC(boolean_T rtu_X, boolean_T rtu_Y, uint16_T
  rtu_T_ON, uint16_T rtu_T_OFF, boolean_T *rty_Z, DW_Timer_Delay_Check_CRC_SOC_T
  *localDW)
{
  uint16_T rtb_Switch3_l;
  if (rtu_X) {
    rtb_Switch3_l = (uint16_T)(localDW->UnitDelay_DSTATE + 1U);
  } else {
    rtb_Switch3_l = 0U;
  }

  if (rtb_Switch3_l < (uint16_T)(rtu_T_ON + 1U)) {
    localDW->UnitDelay_DSTATE = rtb_Switch3_l;
  } else {
    localDW->UnitDelay_DSTATE = (uint16_T)(rtu_T_ON + 1U);
  }

  if (rtu_Y) {
    rtb_Switch3_l = (uint16_T)(localDW->UnitDelay2_DSTATE + 1U);
  } else {
    rtb_Switch3_l = 0U;
  }

  if (rtb_Switch3_l < (uint16_T)(rtu_T_OFF + 1U)) {
    localDW->UnitDelay2_DSTATE = rtb_Switch3_l;
  } else {
    localDW->UnitDelay2_DSTATE = (uint16_T)(rtu_T_OFF + 1U);
  }

  if (localDW->UnitDelay_DSTATE >= (uint16_T)(rtu_T_ON + 1U)) {
    *rty_Z = true;
  } else {
    *rty_Z = ((localDW->UnitDelay2_DSTATE < (uint16_T)(rtu_T_OFF + 1U)) &&
              localDW->UnitDelay1_DSTATE);
  }

  localDW->UnitDelay1_DSTATE = *rty_Z;
}
